
var goodslist = require("../models/goodslist");

addSalse = function (opts) {
    return new Promise ((resolve, reject) => {
        // goodslist.create( opts ,function(err,doc){
        //     if (err) reject(err)
        //     else resolve()
        // })
        console.log(opts)
        goodslist.findOne({ //查找一条
            _id:opts
        },(err, doc)=>{
           let salse = doc.salse + 1;

            goodslist.update({
                _id:opts
            },{
                $set:{"salse" : salse}
            },function(err1,doc1){
                if (err1) reject(err1)
                else resolve()
            })
        });
    })
}

module.exports = addSalse